package demo2.annotation_250225;

import java.lang.annotation.*;

@Annotation2(value = "嘻嘻")
public class annotation1 {


    private String name;



    public static void main(String[] args) {
        annotation1 a1 = new annotation1();
        Annotation2 annotation = a1.getClass().getAnnotation(Annotation2.class);
        System.out.println(a1.getClass().isAnnotationPresent(Anno3.class));
        System.out.println(annotation.value());
        System.out.println(annotation.sex());
        System.out.println(annotation.sex().equals(Annotation2.SEX_TYPE.MAN));
    }
}

@Target({ElementType.FIELD,ElementType.METHOD,ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
 @interface Annotation2{

    enum SEX_TYPE{MAN,WOMAN}

    String value() default "default";
    SEX_TYPE sex() default SEX_TYPE.MAN;

}

@Retention(RetentionPolicy.RUNTIME)
@Documented
@interface Anno3{}